{% extends "base.html" %}

{% block content %}


<script language=javascript>

function verify(form){
{% ifequal level 'administrators' %}
  if(form.name.value==""){
	alert("Enter the name please!");
	form.name.focus();		
       return false;
	}
{% endifequal %}
  if(form.truename.value==""){
	alert("Enter the truename please!");
	form.truename.focus();		
       return false;
	}
  if(form.tel.value==""){
	alert("Enter the tel please!");
	form.tel.focus();		
       return false;
	}
  if(form.mobile.value==""){
	alert("Enter the mobile please!");
	form.mobile.focus();		
       return false;
	}
  if(form.email.value==""){
	alert("Enter the email please!");
	form.email.focus();		
       return false;
	}

return true;
 }
function verify2(form){
  if(form.oldpassword.value==""){
	alert("Enter the old password please!");
	form.oldpassword.focus();		
       return false;
	}
	 if(form.password.value==""){
	alert("Enter password please");
	form.password.focus();		
       return false;
	}
	 if(form.password2.value==""){
	alert("Enter the confirm password please");
	form.password2.focus();		
       return false;
	}
	 if(form.password.value!=form.password2.value){
	  alert("The confirm password is not the same with password");
       return false;
	}
return true;
 }
</script>


<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">
<form name='form1' id='form1' action="/savename/" method='post' onsubmit='return verify(this);'>
<table width='650' class='grid' cellspacing='1' align='center'><tr><td colspan='2' class='title'>Modify</td></tr>
<tr valign='middle' align='left'></tr>
{% ifequal level 'administrators' %}
<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>Name:</td>
<td class='even'><input type="text" name="name" value="{{salesperson.name}}" /></td></tr>
{%endifequal%}
<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>True Name:</td>
<td class='even'><input type="text" name="truename" value="{{salesperson.truename}}"/></td></tr>
<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>Tel:</td>
<td class='even'><input type="text" name="tel"  value="{{salesperson.tel}}"/></td></tr>
<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>Mobile:</td>
<td class='even'><input type="text" name="mobile"  value="{{salesperson.mobile}}"/></td></tr>
<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>Email:</td>
<td class='even'><input type="text" name="email"  value="{{salesperson.email}}"/></td></tr>
{% if flashmsg %}
<tr valign='middle' align='left'><td class='odd' colspan=2" width='100%' align="center" style="color:red">{{flashmsg}}</td>
</tr>
{% endif %}
<tr valign='middle' align='left'><td class='odd' width='25%'></td>
<td class='even'>&nbsp;<input type='submit' class='button' name='submit'  id='submit' value=' Submit ' />&nbsp;&nbsp;</form></td></tr>

</table>

<br />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">
<form name='form2' id='form2' action="/savepassword/" method='post' onsubmit='return verify2(this);'>
<table width='650' class='grid' cellspacing='1' align='center'><tr><td colspan='2' class='title'>Modify Login Password</td></tr>
<tr valign='middle' align='left'></tr>

<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>Old password:</td>
<td class='even'><input type="password" name="oldpassword" /></td></tr>
<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>New password:</td>
<td class='even'><input type="password" name="password" /></td></tr>
<tr valign='middle' align='left'><td class='odd' width='25%'><font color="red">*</font>New password again:</td>
<td class='even'><input type="password" name="password2" /></td></tr>
{% if flashmsg2 %}
<tr valign='middle' align='left'><td class='odd' colspan=2" width='100%' align="center" style="color:red">{{flashmsg2}}</td>
</tr>
{% endif %}
<tr valign='middle' align='left'><td class='odd' width='25%'></td>
<td class='even'>&nbsp;<input type='submit' class='button' name='submit'  id='submit' value=' Submit '  />&nbsp;&nbsp;</form></td></tr>

</table>

{% endblock %}
